<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>仓库</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/search.css">

</head>
<body style="overflow-x:hidden;background:#f3f3f3;">
<div class="btn-div">
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#demoModal">新增</button>
</div>
<!-- 表格部分 -->
<div>
    <table class="table table-condensed">
        <thead>
        <tr>
            <th>序号</th>
            <th>用户账号</th>
            <!--<th>用户密码</th>-->
            <th>手机号码</th>
            <th>用户权限</th>
            <th class="operation">操作</th>
        </tr>
        </thead>
        <tbody>
        <!--/*@thymesVar id="user" type="com.connext.wms.entity.User"*/-->
        <tr th:each="user:${users}">
            <td></td>
            <td th:text="${user.username}"></td>
            <!--<td th:text="${user.password}"></td>-->
            <td th:text="${user.telephone}"></td>
            <td th:text="${user.role}"></td>
            <td th:text="${user.id}" style="display:none"></td>
            <td class="operation">
                <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#demoModal-1"
                        th:onclick="|getData(${user.id})|">修改
                </button>
                <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#demoModal-3"
                        th:onclick="|getData1(${user.id})|">修改密码
                </button>
                <button type="button" class="btn btn-danger btn-xs" data-toggle="modal" data-target="#demoModal-2"
                        th:onclick="|getData(${user.id})|">删除
                </button>
            </td>
        </tr>
        </tbody>
    </table>
</div>

<!-- 弹出框 -->
<!--新增弹出框-->
<div class="modal fade" id="demoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="clean()">&times;</button>
                <h4 class="modal-title" id="myModalLabel">新增用户</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal add" role="form" id="form1">
                    <div class="form-group">
                        <label for="username" class="col-sm-2 control-label">用户名称</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" class="form-control" required id="username"
                                   placeholder="请输入用户名称" onblur="checkName1();checkSave()"/><span id="user_name1"
                                                                                                  class="notice"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="password" class="col-sm-2 control-label">用户密码</label>
                        <div class="col-sm-10">
                            <input type="password" name="password" class="form-control" id="password" required
                                   placeholder="请输入用户密码" onblur="checkPass1();checkSave()"/><span id="password1"
                                                                                                  class="notice"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="telephone" class="col-sm-2 control-label">用户手机</label>
                        <div class="col-sm-10">
                            <input type="text" name="telephone" class="form-control" id="telephone" required
                                   placeholder="请输手机号" onblur="checkReg();checkPhone1();checkSave()"/><span
                                id="user_phone" class="notice"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="role" class="col-sm-2 control-label">用户权限</label>
                        <div class="col-sm-10">
                            <select id="role" name="role" style="outline:none;" class="form-control">
                                <option value="InRepertory">入库管理员</option>
                                <option value="OutRepertory">出库管理员</option>
                                <option value="manage" selected="selected">库存管理员</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clean()">取消</button>
                <button type="button" class="btn btn-primary save" data-dismiss="modal" id="save" onclick="insert()">
                    保存
                </button>
            </div>
        </div>
    </div>
</div>

<!--编辑弹出框-->
<div class="modal fade" id="demoModal-1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="clean()">&times;</button>
                <h4 class="modal-title" id="myModalLabel-1">编辑用户</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal compile" role="form" id="form2">
                    <div class="form-group">
                        <label for="firstname-1" class="col-sm-2 control-label">用户名称</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" class="form-control" id="firstname-1"
                                   oninput="checkName2();checkSave1()"> <span
                                id="user_name2" class="notice"></span>
                            <input type="hidden" name="firstname-id" id="firstname-id">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="userpassword" class="col-sm-2 control-label">用户密码</label>
                        <div class="col-sm-10">
                            <input type="password" name="userpassword" class="form-control" id="userpassword"
                                   readonly><span id="password2" class="notice"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="lastname-1" class="col-sm-2 control-label">用户手机</label>
                        <div class="col-sm-10">
                            <input type="text" name="telephone" class="form-control" id="lastname-1"
                                   oninput="checkPhone2();checkSave1()"><span id="user_phone1"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="lastname-3" class="col-sm-2 control-label">用户权限</label>
                        <div class="col-sm-10">
                            <select id="lastname-3" name="role" style="outline:none;" class="form-control">
                                <option value="InRepertory">入库管理员</option>
                                <option value="OutRepertory">出库管理员</option>
                                <option value="manage" selected="selected">库存管理员</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clean()">取消</button>
                <button type="button" class="btn btn-primary save" data-dismiss="modal" id="save1" onclick="modify()">
                    保存
                </button>
            </div>
        </div>

    </div>
</div>

<!--修改密码弹出框-->
<div class="modal fade" id="demoModal-3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="clean()">&times;</button>
                <h4 class="modal-title" id="myModalLabel-3">修改密码</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal compile" role="form" id="form3">
                    <div class="form-group">
                        <label for="userpassword1" class="col-sm-2 control-label">用户密码</label>
                        <div class="col-sm-10">
                            <input type="password" name="userpassword1" class="form-control" id="userpassword1"
                                   oninput="checkPass3()"><span id="password3" class="notice"></span>
                            <input type="hidden" name="pwd_id" id="pwd_id">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clean()">取消</button>
                <button type="button" class="btn btn-primary save" data-dismiss="modal" id="save2"
                        onclick="modifyPass()" disabled>保存
                </button>
            </div>
        </div>

    </div>
</div>

<!--删除弹出框-->
<div class="modal fade" id="demoModal-2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header" style="border: 0">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel-2">确认要删除当前用户吗</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer" style="border: 0">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="deleteUser()">确认删除</button>
            </div>
        </div>
    </div>
</div>
</div>
</body>
<script type="text/javascript" src="/js/registerLoading/register.js"></script>
</html>